package com.booking.dao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.booking.common.dto.PageReq;
import com.booking.common.dto.PageResp;
import com.booking.common.utils.ConvertUtils;
import com.booking.dao.entity.AuditRecord;
import com.booking.dao.mapper.AuditRecordMapper;
import com.booking.dao.service.AuditRecordService;
import org.springframework.stereotype.Service;

/**
 * @author Qikai.Lin
 * @date 2023/4/23
 */
@Service
public class AuditRecordServiceImpl extends ServiceImpl<AuditRecordMapper, AuditRecord>
        implements AuditRecordService {
    @Override
    public PageResp<AuditRecord> getPage(PageReq<Object> request) {
        QueryWrapper<AuditRecord> pageQueryWrapper = new QueryWrapper<>();
        Page<AuditRecord> recordPage = new Page<>(request.getCurrent(), request.getSize());
        Page<AuditRecord> page = this.page(recordPage, pageQueryWrapper);
        return ConvertUtils.convert(PageResp.class, page);
    }
}
